OpenCores

Introduction

This project aims to maintain a set of easy to use development tools for the OpenRISC platform.

The included tools are currently:

  • GNU binutils-2.18.50
  • GNU GCC-4.2.2
  • GNU GDB-6.8
  • uClibc-0.9.29
  • Linux-2.6.24
  • BusyBox-1.7.5
  • or1ksim-0.3.0

Installation

Script download

The normal method of installation for the GNU toolchain uses a script which will download and install the latest versions of all tools. The script can be downloaded here.

The latest version of the toolchain, version 5a, has finally been released. It is a significant upgrade the previous version, including a new version of GCC, the Linux kernel, GDB and or1ksim. Also note the prefix of the resulting executables is now or32-elf rather than or32-uclinux as it was under the previous toolchain version.

Toolchain installation for Linux

System setup

Compiling the OpenRISC toolchain from sources requires that some standard development tools are already installed. Most of these tools are pre-installed in modern Linux distributions. However, some may still require installation before the OpenRISC toolchain can be built.
The specifics of installing these required tools differs from distro to distro. The example given here uses the apt-get package management tool common among Debian and Ubuntu distros (among others,) however it should be easy enough to perform this installation using the package management tool your system uses.

Under Ubuntu, the following set of commands should ensure all packages required to build the OpenRISC toolchain are installed:

sudo apt-get update
sudo apt-get -y install build-essential
sudo apt-get -y install make
sudo apt-get -y install gcc
sudo apt-get -y install g++
sudo apt-get -y install flex
sudo apt-get -y install bison
sudo apt-get -y install patch
sudo apt-get -y install texinfo
sudo apt-get -y install libncurses-dev

Once these tools are installed on the system, the toolchain script can be downloaded and run.

Perform the installation

Save the script in a new directory. Open a console, change path to where the script is located and run:

sh MOF_ORSOC_TCHN_v5c_or32-elf.sh

Follow the prompts given by the script. It will automatically attempt to install the toolchain under the current directory, but it can be targeted to install anywhere on the current system. For instance, setting the install path as /opt will result in the toolchain being installed under /opt/or32-elf however in most cases installation to any path outside of the user's home directory will require root access, or the script being with sudo.

Please ensure that at least 2 gigabytes of storage is available on the local harddisk before building the toolchain. Compile time can be anywhere from 30 minutes to 2 hours, depending on the host machine.

Toolchain installation for Cygwin Windows

System setup

The Cygwin Unix-like shell environment for Windows is required to build and use the toolchain. See the Cygwin website for instructions on how to install the basic Cygwin package.

There are some applications and libraries which must be installed in addition to the basic Cygwin packages. These are installed by running Cygwin's setup.exe, and continuing to the package "chooser" window, which, by default, presents all available packages sorted by category. Follow the list below, expand the appropriate category and mark the listed programs for install.

Category: Devel
  • autoconf
  • automake
  • binutils
  • bison
  • gcc (gcc:C compiler upgrade helper)
  • gettext-devel
  • libiconv
  • libncurses-devel
  • make
Category: Utils
  • bzip2
  • patch
Category: Web
  • wget

Once these applications and libraries are marked for installation continue with setup.exe until it is finished. The Cygwin system should now be capable of compilation of the OpenRISC toolchain.

Perform the installation

Save the script in a new directory. Open a console, change path to where the script is located and run:

sh MOF_ORSOC_TCHN_v5c_or32-elf.sh

Follow the prompts given by the script. It will automatically attempt to install the toolchain under the current directory, but it can be targeted to install anywhere on the current system. For instance, setting the install path as /opt will result in the toolchain being installed under /opt/or32-elf. Please note that the BusyBox applications built in the script cannot be installed into the ramdisk due to ext2 filesystem support issues under Cygwin.

Toolchain installation for Mac OS X

At present the script does not compile the toolchain completely under Mac OS X. The last few issues are being worked out by the contributors and as soon as a solution has been found the script will be updated and the solution will be posted here.

The issues relate to the building of the BusyBox tools and the or1k simulator. The remainder of the toolchain appears to compile without an issue. It is possible to compile just the working parts of the toolchain with the current script.

Toolchain installation by hand

Embecosm Application Note 2 outlines manually compiling and installing the individual components of the OpenRISC toolchain. This is useful for those who wish to customise the components included in the toolchain, or those who experience trouble with the provided install script.

Feedback, Bugs and Assistance

To participate in development, or discuss and report success/failure building the toolchain, go to the OpenRISC forum.
Or keep up to date with the goings on of the toolchain by subscribing to the OpenRISC mailing list. Enable the subscription by going to your OpenCores account page (click My Account in the top left of the page) and check the openrisc box under Subscriptions.

Further details on toolchain components

This set of tools, or toolchain, is based around the GNU binutils and GNU Compiler Collection (GCC) packages, which provide the basic compilation related functions of the toolchain. Also included are libraries and specialised software for the OpenRISC platform. Included are OpenRISC targeted versions of the uClibc library, the Linux 2.6 kernel and BusyBox. In addition there are some tools aimed at assisting development on the OpenRISC platform. The GNU Debugger (GDB) is included and can be used to debug code running on the OpenRISC architectural simulator, or the or1ksim tool, which is also included in this project. To ensure an easy installation process, and automated install script is provided.

GNU binutils

This is a collection of tools for the manipulation of object code in various object file formats. Among its many tools, it provides the assembler and linker.

More information about the GNU project's release of binutils can be found at its homepage.

GNU GCC

A version of GCC targeted at the OpenRISC platform is provided here. Known as a cross compiler, it is a version which will create code that is executable on an OpenRISC processor.

For more information about the official GCC releases can be found at the project's homepage.

Known issues:

  • Backwards compatibility issue: The old GCC 3.4.4 for OpenRISC defined three constants, OR1K, __or1k__ and __OR1K__, allowing users to bracket OpenRISC dependent code with #ifdef __OR1K__. These are not at present defined in the current GCC 4.2.2 by default, so users must explicitly set them by hand

  • Backwards compatibility issue: The old GCC 3.4.4. for OpenRISC assumed the availability of hardware multiplication, but not hardware division by default (i.e. -mhard-mul, -msoft-div), which was consistent with the default Verilog configuration. The current GCC 4.2.2 appears to assume neither hardware multiplication nor hardware division are present (i.e. -msoft-mul, -msoft-div). The old behavior can be restored by using -mhard-div on the GCC command line of in the CFLAGS within Makefiles.

GNU GDB

The GNU Project Debugger (GDB) is a standard debugging tool. It is used for debugging code whilse it is executing on any OpenRISC target, be it simulated (architectural simulator or RTL) or physical (FPGA, or ASIC.) At early stages of development it is the easiest way of transferring and running code in an OpenRISC based system.

GDB 6.8 has now been ported to the OpenRISC 1000 architecture. The latest version (2.1) of the source code patch for the standard GDB 6.8 distribution is available in the OpenRISC 1000 Downloads section here.

This latest version supports the GDB Remote Serial Protocol (RSP), which will ensure ongoing compatibility with GDB in future releases. The legacy OpenRISC Remote JTAG Protocol is still supported for backwards compatibility, but is now deprecated. All new users and applications should adopt the RSP interface.

This version of GDB works directly with Or1ksim 0.3.0, the current stable release of The OpenRISC 1000 Architectural Simulator, Or1ksim. It is not suitable for earlier versions of the simulator.

To date this release has been tested on the architectural simulator, Or1ksim, a cycle accurate Verilator model of ORPSoC and on the ORSoC FPGA board. Feedback from users on experience with other hardware (via the tracker) will be appreciated.

Details of the internal workings of the GDB 6.8 port for OpenRISC 1000 can be found in the application note Howto: Porting the GNU Debugger: Practical Experience with the OpenRISC 1000 Architecture published by Embecosm.

Details of the implementation of the RSP server functionality for Or1ksim can be found in the application note Howto: GDB Remote Serial Protocol: Writing a RSP Server published by Embecosm.

This version of GDB works with the graphical user interface DDD. It has also been tested with the Insight graphical debugger and appears to work.

Known issues:

  • Message "Value being assigned to is no longer active" when trying to alter a register immediately after loading a new program image. This is a known bug in GDB. It is one feature of a complex problem with the way GDB represents stack frames.

    One workaround is to set a breakpoint on the first instruction of the loaded image, run to that breakpoint (which will do nothing), and then GDB will allow registers to be set. However user nyawn has found a small patch from the Fedora project which fixes this particular problem. It can be found at:

    cvs.fedoraproject.org/viewvc/devel/gdb/gdb-6.8-bz436037-reg-no-longer-active.patch?view=log

uClibc

This is a C library aimed at embedded Linux systems. It removes a lot of the bulk that comes with a standard C library, such as the GNU C Library, making it more suitable for compiling embedded applications against.

For more information about uClibc see the project's homepage.

Linux kernel

An operating system kernel. It is ported to the OpenRISC architecture and features preemptive multitasking, virtual memory and threading to name just a few things.
For more information about the Linux kernel sources see the project's homepage.

BusyBox

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc.
For more information about BusyBox see the project's homepage.

OpenRISC architectural simulator

A simulator of the generic OpenRISC 1000 architecture simulator capable of emulating OpenRISC based computer systems. It provides high level, fast architectural simulation that allows early code analysis and system performance evaluation.

For more information see the project's homepage here at OpenCores.

Wishlist

The following is a list of future work for the GNU toolchain port.
If you want to help, send an email to the mailing list.

  • Test toolchain with latest BusyBox (1.13.4) and other applications.
  • Ability to create the filesystem from scratch using sytem device scripts and ext2fs tools.
  • A nice tutorial, showing off the installation and use of the new toolchain.
  • Port of the toolchain enabling the 64-bit features of the OpenRISC spec.
  • Write optimized versions of routines in uClibc instead of using generic ones.
  • Testing the script and resulting toolchain on other platforms.

Feel free to post any suggestions to the OpenRISC forum.

Developers

The team working on the GNU Toolchain port:

  • Jeremy Bennett, jeremybennett@opencores.org (GDB, Or1ksim)
  • Rich D'Addio, rich_daddio@opencores.org
  • Marcus Erlandsson, marcus.erlandsson@opencores.org
  • Julius Baxter, julius@orsoc.se (install script)

Past contributor(s)

These are the people currently not working on the GNU Toolchain, but have contributed in the past:

  • Johan Rydberg, jrydberg@opencores.org
  • Marko Mlinar, markom@opencores.org
  • Simon Srot, simons@opencores.org
  • Matjaz Breskvar, phoenix@opencores.org
  • Balint Cristian rezso@opencores.org
  • and many more, thanks to all of you!